﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SQLServerOptimizer.PL.WPF;
using System.Security.Cryptography;
using AG.Utilities;

namespace SQLServerOptimizer.KeyGenerator
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnGenerateKey_Click(object sender, EventArgs e)
        {
            txtProductKey.Text = Licensing.GenerateProductKey(txtEmail.Text.Trim().ToLower(), typeof(MainWindow).Assembly);
        }

        private void btnValidate_Click(object sender, EventArgs e)
        {
            if (Licensing.IsValidProductKey(txtEmail.Text.ToLower(), txtProductKey.Text.ToLower(), typeof(MainWindow).Assembly))
            {
                MessageBox.Show("Valid productkey");
            }
            else
            {
                MessageBox.Show("Invalid productkey!");
            }

        }
    }
}
